package y23.Jun;

import java.util.Scanner;

//求任意整数每一位的和
public class Test12 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while(sc.hasNext()){
            int num = sc.nextInt();
            System.out.println(sumNum(num));
        }
    }
    public static int sumNum(int num){
        if(num < 10){
            return num;
        }
        return sumNum(num / 10) + (num % 10);
    }
}
